package com.jia.interviewPro;

/**
 * 面试题05.06.整数转换
 *
 */
public class Pro0506 {
    //异或，然后统计1的个数
    public int convertInteger(int A, int B) {
        A = A ^ B;
        //count bit of 1
        int ans = 0;
        while(A != 0) {
            A &=(A - 1);
            ++ans;
        }
        return ans;
    }
}
